package order.controller;

import lombok.extern.slf4j.Slf4j;
import order.dao.OrderInfo;
import order.server.OrderServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderServer orderServer;

    @RequestMapping("/{orderId}")
    public OrderInfo getOrder(@PathVariable("orderId") int orderId) {
        OrderInfo o = orderServer.getOrderById(orderId);
        log.info(o.toString());
        return o;
    }
}
